package com.mt.roll.report.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mt.roll.core.api.Assert;
import com.mt.roll.core.base.BaseService;
import com.mt.roll.core.errorcode.ApiErrorCode;
import com.mt.roll.core.vo.PageVo;
import com.mt.roll.core.vo.R;
import com.mt.roll.report.mapper.ReportStorageBoxVoMapper;
import com.mt.roll.report.params.ReportStorageBoxQueryParam;
import com.mt.roll.report.service.ReportStorageBoxService;
import com.mt.roll.report.vo.ReportStorageBoxVo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: yulianchen
 * @Date: 2022/3/4 9:36
 * @Version 1.0
 */
@Service
@Transactional
public class ReportStorageBoxServiceImpl extends BaseService implements ReportStorageBoxService {
    @Resource
    private ReportStorageBoxVoMapper reportStorageBoxVoMapper;
    @Override
    public R<List<ReportStorageBoxVo>> list(ReportStorageBoxQueryParam reportStorageBoxQueryParam) {
        List<ReportStorageBoxVo> reportStorageBoxVoList = reportStorageBoxVoMapper.getReportStorageBoxVoList(reportStorageBoxQueryParam.getCode());
        return successful(reportStorageBoxVoList);
    }
    /**
     * 获取工艺分页列表
     *
     * @param reportStorageBoxQueryParam    存储箱查询参数：存储箱编码
     * @return 存储箱分页报表
     */
    @Override
    public R<PageVo<ReportStorageBoxVo>> page(ReportStorageBoxQueryParam reportStorageBoxQueryParam) {
        IPage<ReportStorageBoxVo> reportStorageBoxVoList = reportStorageBoxVoMapper.getReportStorageBoxVoList(new Page<>(reportStorageBoxQueryParam.getCurrent(), reportStorageBoxQueryParam.getSize()), reportStorageBoxQueryParam.getCode());
        return successful(new PageVo<>(reportStorageBoxVoList,ReportStorageBoxVo.class));
    }
}
